<template>
    <div>
        <el-card class="box-card">
            <div slot="header" class="clearfix" style="text-align: center;line-height: 30px">
                <h3>查看客户信息</h3>
            </div>

            <div class="text item">
                <el-form :model="ruleForm" ref="ruleForm" label-width="100px" class="demo-ruleForm">

                    <el-row>
                        <el-col :span="12"><div class="grid-content bg-purple">
                            <el-form-item label="客户名称" prop="name">
                                <el-input v-model="ruleForm.name"></el-input>
                            </el-form-item>
                        </div></el-col>
                        <el-col :span="12"><div class="grid-content bg-purple-light">
                            <el-form-item label="负责人" prop="name">
                                <el-input v-model="ruleForm.mainperson"></el-input>
                            </el-form-item>
                        </div></el-col>
                    </el-row>
                    <br>

                    <el-row>
                        <el-col :span="12"><div class="grid-content bg-purple">
                            <el-form-item label="负责人电话" prop="name">
                                <el-input v-model="ruleForm.tel"></el-input>
                            </el-form-item>
                        </div></el-col>
                        <el-col :span="12"><div class="grid-content bg-purple-light">
                            <el-form-item label="办公地址" prop="name">
                                <el-input v-model="ruleForm.address"></el-input>
                            </el-form-item>
                        </div></el-col>
                    </el-row>
                    <br>

                    <el-row>
                        <el-col :span="12"><div class="grid-content bg-purple">
                            <el-form-item label="邮箱" prop="name">
                                <el-input v-model="ruleForm.email"></el-input>
                            </el-form-item>
                        </div></el-col>
                        <el-col :span="12"><div class="grid-content bg-purple-light">
                            <el-form-item label="经营范围">
                                <el-input type="textarea" v-model="ruleForm.scope"></el-input>
                            </el-form-item>
                        </div></el-col>
                    </el-row>
                    <br>

                    <el-row>
                        <div style="text-align: center">
                            <el-form-item>
                                <el-button type="primary" @click="onSubmit">确定</el-button>
                            </el-form-item>
                        </div>
                    </el-row>
                </el-form>
            </div>
        </el-card>
    </div>
</template>

<script>
    export default {
        name: "FindCustomer",
        props:{
            buyId:JSON
        },
        data(){
            return{
                ruleForm:{
                    name:'',
                    mainperson:'',
                    tel:'',
                    address:'',
                    email:'',
                    scope:''
                }
            }
        },
        mounted() {
            this.init()
        },
        methods:{
            init(){
                let customid = this.$store.state.customid
                let url = 'api/custom/getById?id='+customid
                this.$axios.get(url).then(r=>{
                    let datas = r.data
                    this.ruleForm.name =datas.customname
                    this.ruleForm.mainperson = datas.boss
                    this.ruleForm.tel =  datas.phone
                    this.ruleForm.address = datas.address
                    this.ruleForm.email = datas.email
                    this.ruleForm.scope = datas.scope
                })
            },
            onSubmit() {
                this.$router.push("CustomerView")
            }
        }
    }
</script>

<style scoped>

</style>